<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <script>
    // setTimeout(() => {
    //   console.log("Hello World");
    // }, 1000)

    // resolve, reject都是函数
    new Promise((resolve, reject) => {
      setTimeout(() => {
        // 一旦调用resolve，即开始执行then
        resolve();
      }, 1000);
    }).then(() => {
      console.log("Hello World");
      console.log("Hello World");
      console.log("Hello World");
      console.log("Hello World");
      console.log("Hello World");
      console.log("Hello World");

      return new Promise((resolve, reject) => {
        setTimeout(() => {
          // resolve会去找最外面的Promise的then
          resolve();
        }, 1000);
      });
      // 链式编程
    }).then(() => {
      console.log("Hello vueJs");
      console.log("Hello vueJs");
      console.log("Hello vueJs");
      console.log("Hello vueJs");
      console.log("Hello vueJs");
      console.log("Hello vueJs");

      return new Promise((resolve, reject) => {
        setTimeout(() => {
          resolve();
        }, 1000);
      });
    }).then(() => {
      console.log("Hello Python");
      console.log("Hello Python");
      console.log("Hello Python");
      console.log("Hello Python");
      console.log("Hello Python");
      console.log("Hello Python");
    });

  </script>
</body>
</html>